package com.frank.oj.service.entity.group.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.frank.model.entity.group.Group;
import com.frank.oj.mapper.GroupMapper;
import com.frank.oj.model.vo.GroupVO;
import com.frank.oj.service.entity.group.GroupEntityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author frank
 * @Date 2024/3/29
 */
@Service
public class GroupEntityServiceImpl extends ServiceImpl<GroupMapper, Group> implements GroupEntityService {

    @Resource
    private GroupMapper groupMapper;

    @Override
    public IPage<GroupVO> getGroupList(Integer limit, Integer currentPage, String keyword, Integer auth, String uid, boolean isRoot, Boolean onlyMine) {
        Page<GroupVO> page = new Page<>(currentPage,limit);
        List<GroupVO> groupList=groupMapper.getGroupList(page, keyword, auth, uid, isRoot, onlyMine);

        return page.setRecords(groupList);
    }
}
